<template>
  <!-- 客户姓名，电话，地址的添加 -->
  <div class="userOrder">
    <div>
      <van-address-edit
        :area-list="areaList"
        show-delete
        show-set-default
        show-search-result
        :search-result="searchResult"
        :area-columns-placeholder="['请选择', '请选择', '请选择']"
        @save="onSave"
        @delete="onDelete"
        @change-detail="onChangeDetail"
      />
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
  name: 'Child'
})
</script>
<script lang="ts" setup>
import { areaList } from '@vant/area-data'
import { showToast } from 'vant'
import { ref } from 'vue'
import { useRouter } from 'vue-router'

// 地址添加
const searchResult = ref([])
const router = useRouter()
const onSave = () => {
  showToast('save')
  router.push({
    path: '/shopcart/order'
  })
}
const onDelete = () => showToast('delete')
const onChangeDetail = (val: any) => {
  if (val) {
    searchResult.value = []
  } else {
    searchResult.value = []
  }
}
</script>

<style lang="less" scoped>
.userOrder {
  background-color: beige;
}
</style>
